
extension MapExtension on Map {
  double doubleValue(String key,{double defaultVal=0}){
    Object val = this[key];
    return val != null?double.tryParse("$val")??defaultVal:defaultVal;
  }

  int intValue(String key,{int defaultVal=0}){
    Object val = this[key];
    if(val is double){
      return val.toInt();
    }
    if(val is String){
      return int.tryParse(val.split('.')[0])??defaultVal;
    }
    return val != null?int.tryParse("$val")??defaultVal:defaultVal;
  }

  String strValue(String key,{String defaultVal=""}){
    Object val = this[key];
    return val != null?"$val":defaultVal;
  }

  bool boolValue(String key,{bool defaultVal = false}){
    Object val = this[key];
    return val ?? defaultVal;
  }

  List listValue(String key){
    Object val = this[key];
    return val??[];
  }

}